import { h } from 'vue';
import { NAvatar, NButton } from 'naive-ui';
import { BasicColumn } from '@/components/Table';
export interface ListData {
  id: string;
  name: string;
  avatar: string;
  address: string;
  beginTime: string;
  endTime: string;
  date: string;
  [key: string]: string;
}
import { useUserStore } from '@/store/modules/user';

export function columns(sendMail, showRolesModal): BasicColumn<ListData>[] {
  return [
    {
      type: 'selection',
    },
    {
      title: '店铺名称',
      key: 'shop_name',
    },
    {
      title: '任务负责人',
      key: 'task_people',
      render(row) {
        return [
          {
            name: '吴丹绮',
            value: 'wudanqi',
          },
          {
            name: '郭姐',
            value: 'guojie',
          },
          {
            name: '吴娇杰',
            value: 'wujiaojie',
          },
          {
            name: '陈萍',
            value: 'chenping',
          },
          {
            name: '吕灵娜',
            value: 'lulingna',
          },
        ].find((item) => item.value == row.task_people)?.name;
      },
    },
    {
      title: 'eBay订单号',
      key: 'eBay_order_number',
      render(row) {
        return h(
          'span',
          {
            size: 'small',
            text: true,
            onClick: () => sendMail(row),
          },
          { default: () => row.eBay_order_number }
        );
      },
    },
    {
      title: '订单状态',
      key: 'pre_status',
    },{
      title: '上次订单负责人',
      key: 'pre_people',
    },
    {
      title: '出单时间',
      key: 'issue_time',
    },
    {
      title: '最晚发货时间',
      key: 'latest_delivery_time',
    },
    {
      title: '最晚到货时间',
      key: 'latest_arrival_time',
    },
    {
      title: '客户名字',
      key: 'customer_name',
    },
    {
      title: '客户电话',
      key: 'customer_phone',
    },

    {
      title: '客户地址1',
      key: 'customer_address1',
    },
    {
      title: '客户地址2',
      key: 'customer_address2',
    },
    {
      title: '城市',
      key: 'city',
    },
    {
      title: '州',
      key: 'state',
    },
    {
      title: '邮编',
      key: 'zip',
    },
    {
      title: '操作',
      key: 'options',
      render(row) {
        return h(
          NButton,
          {
            size: 'small',
            onClick: () => showRolesModal(row),
            disabled: useUserStore().info?.authority == 0,
          },
          { default: () => '分配' }
        );
      },
    },
  ];
}
